Skip to content

Conversation

ausbru87
Copy link

Closes #123

Adds automated security scanning to improve supply chain security for air-gapped deployments:

Changes

  • CodeQL: Daily Go code vulnerability scanning
  • Trivy: Filesystem and Docker image scanning for dependencies
  • OpenSSF Scorecard: Weekly security best practices assessment
  • Enhanced Dependabot: Commit prefixes and patch update filtering

All scan results are uploaded to GitHub Security tab for centralized monitoring.

Testing

  • Workflows will run on this PR to validate configuration
  • Docker image scan will run once images are published

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

- Scan LOW,MEDIUM,HIGH,CRITICAL instead of only HIGH,CRITICAL
- Remove Docker image scan (no :latest tag exists)
Enable vuln, secret, and misconfig scanners explicitly
- Build Go binary for linux/amd64
- Build Docker image with buildx
- Scan the built image (not filesystem)
- Matches coder/coder scanning approach
- Add table format scan to show results in workflow logs
- Upload SARIF as artifact for manual inspection
- Matches coder/coder artifact upload pattern
@ausbru87 ausbru87 requested a review from Copilot October 12, 2025 05:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive automated security scanning workflows to improve supply chain security for air-gapped deployments. The changes include CodeQL vulnerability scanning, Trivy image scanning, OpenSSF Scorecard security assessment, and enhanced Dependabot configuration.

  • Automated daily security scanning with CodeQL and Trivy
  • Weekly OpenSSF Scorecard security best practices assessment
  • Enhanced Dependabot with commit prefixes and patch update filtering

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
CHANGELOG.md Documents the addition of security scanning workflows and Dependabot enhancements
.github/workflows/security.yaml Main security workflow with CodeQL and Trivy scanning jobs
.github/workflows/scorecard.yml OpenSSF Scorecard workflow for security best practices assessment
.github/dependabot.yaml Enhanced configuration with commit prefixes and patch update filtering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ausbru87 ausbru87 self-assigned this Oct 12, 2025
@ausbru87 ausbru87 marked this pull request as ready for review October 12, 2025 05:13
@ausbru87 ausbru87 removed the request for review from jdomeracki-coder October 14, 2025 03:27
Makefile Outdated

TAG=$(shell git describe --always)

build/linux/amd64:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build/linux/amd64:
bin/coder-marketplace-linux-amd64:

You can keep the PHONY (after editing the target name) for simplicity's sake though, otherwise you'll need to specify every Go-related file as a dependency

Copy link
Author

@ausbru87 ausbru87 Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to leave PHONY or to use a pattern like one of the following to ensure Make can still optimize by not building if no Go files change?

bin/code-marketplace-linux-amd64: $(wildcard **/*.go) go.mod go.sum

If you think leaving PHONY is simpler and cleaner then I am open just like using Make to optimize builds even in small repos like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to do it you'll probably have to use shell find cuz I don't think make's wildcard is very good. But it's probably fine to just leave it as PHONY for this PR

@deansheather
Copy link
Member

@code-asher could you give this a review and flag anything that's weird for you? I haven't contributed to this repo before so maybe I'm missing something in my reviews

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thank you!

# Ignore patch updates for all dependencies to reduce PR noise
- dependency-name: "*"
update-types:
- version-update:semver-patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? So far the number of updates seem to have been pretty mild. Or we could group updates weekly or something.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grouped weekly. removed ignore

Comment on lines 10 to 11
commit-message:
prefix: "ci"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge deal, but I think the prefixes may have no use, the changelog is manually curated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed and removed

Comment on lines 24 to 25
commit-message:
prefix: "chore"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed and removed

scorecard.yml:24: actions/checkout → v5.0.0
scorecard.yml:29: ossf/scorecard-action → v2.4.3
security.yaml:32: actions/checkout → v5.0.0 (CodeQL job)
security.yaml:57: actions/checkout → v5.0.0 (Trivy job)
security.yaml:81: aquasecurity/trivy-action → v0.33.1
security.yaml:88: aquasecurity/trivy-action → v0.33.1
removed PHONY alias
added wildcard for .go files
updated security workflow to use explicit build target vs old alias
removed patch ignore and instead we are grouping all-dependencies updates weekly

build/linux/amd64:
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(wildcard **/*.go) go.mod go.sum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does wildcard **/*.go work? I can't find any example of this online, seems like people do a lot of workarounds for this.

In coder/coder we define a variable with the result of a $(shell find ...) command

build/linux/amd64:
# Individual build targets for each OS/arch combination
bin/code-marketplace-mac-amd64: $(wildcard **/*.go) go.mod go.sum
mkdir -p bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could maybe just put a $(shell mkdir -p bin) at the top of the file (not in a target) to avoid having to duplicate it in every target

CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-linux-arm64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-amd64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o bin/code-marketplace-windows-arm64 ./cmd/marketplace/main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=$(TAG)" -o $@ ./cmd/marketplace/main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible would be nice to make the recurring flags here a make variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated security scanning (CodeQL, Trivy, OpenSSF Scorecard)

3 participants